﻿<controls:ChildWindow x:Class="Moria.Silverlight.Controls.StoreDialog"
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
							 xmlns:rb="http://Redbrick/Silverlight"
           Width="630" Height="560" 
           Title="Store">
	<controls:ChildWindow.Resources>
	</controls:ChildWindow.Resources>
	<Grid x:Name="LayoutRoot" Margin="2">
		<Grid.RowDefinitions>
			<RowDefinition />
			<RowDefinition />
			<RowDefinition Height="Auto" />
		</Grid.RowDefinitions>

		<Border BorderBrush="Black" BorderThickness="1" CornerRadius="5,0,5,5" Margin="3">
			<Grid Margin="3" ShowGridLines="True">
				<Grid.ColumnDefinitions>
					<ColumnDefinition/>
					<ColumnDefinition/>
				</Grid.ColumnDefinitions>
				<Grid.RowDefinitions>
					<RowDefinition Height="Auto"/>
					<RowDefinition Height="Auto"/>
					<RowDefinition Height="*" />
				</Grid.RowDefinitions>
				
				<TextBlock HorizontalAlignment="Center" Style="{StaticResource Label}"  Grid.ColumnSpan="2" Text="{Binding Owner.Name}"/>
				<TextBlock Grid.Row="1" HorizontalAlignment="Center" Grid.ColumnSpan="2" Text="{Binding CurrentItem.InventoryItem.Description}"/>

			</Grid>
		</Border>

		<ListBox Grid.Row="1" Margin="3"  ItemsSource="{Binding store_inven}"
					SelectionChanged="SelectedItemChanged">
	
			<ListBox.ItemTemplate>
				<DataTemplate>
					<!--see display_inventory-->
					<Grid Width="Auto" HorizontalAlignment="Stretch">
						<Grid.ColumnDefinitions>
							<ColumnDefinition Width="300"/>
							<ColumnDefinition Width="Auto"/>
						</Grid.ColumnDefinitions>
						<TextBlock Grid.Column="0" Text="{Binding InventoryItem.Description}"/>
						<TextBlock Grid.Column="1" HorizontalAlignment="Right" Text="{Binding AdjustedCost, StringFormat=\{0\,6\}}"/>
					</Grid>
				</DataTemplate>
			</ListBox.ItemTemplate>

		</ListBox>


		<Button x:Name="BuyButton" IsEnabled="False"  Click="BuyButton_Click" Width="Auto" Height="23" HorizontalAlignment="Left" Margin="3" Grid.Row="2" >
			<Grid Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Center">
				<Grid.ColumnDefinitions>
					<ColumnDefinition Width="*"/>
					<ColumnDefinition Width="20"/>
				</Grid.ColumnDefinitions>
				<TextBlock Text="Purchase Item" HorizontalAlignment="Left" Margin="3,0"/>
				<Image Grid.Column="1" Source="/Moria.Silverlight;component/Assets/Images/coins.png" HorizontalAlignment="Right"   Margin="3,0"/>
			</Grid>
		</Button>

		<Button x:Name="OKButton"  Click="OKButton_Click" Width="Auto" Height="23" HorizontalAlignment="Right" Margin="3" Grid.Row="2" >
			<Grid Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Center">
				<Grid.ColumnDefinitions>
					<ColumnDefinition Width="*"/>
					<ColumnDefinition Width="20"/>
				</Grid.ColumnDefinitions>
				<TextBlock Text="Leave Shop" HorizontalAlignment="Left" Margin="3,0"/>
				<Image Grid.Column="1" Source="/Moria.Silverlight;component/Assets/Images/door_in.png" HorizontalAlignment="Right"   Margin="3,0"/>
			</Grid>
		</Button>


	</Grid>
</controls:ChildWindow>